<style>
.layui-form-pane .layui-input-block{
margin-left:140px;
}
.layui-form-pane .layui-form-label{
width:140px;
}
.layui-input, .layui-textarea{
width:77%
}
</style>
<div class="main">
    <!--表单区域  -->
    <link rel="stylesheet" type="text/css" href="${ctx}/adminthemes/version3/css/layerform.css"/>
    <script type="text/javascript" src="${ctx}/adminthemes/version3/plugins/layui/lay/modules/form.js"></script>
    <form id="editForm" class="layui-form layui-form-pane" enctype="multipart/form-data">
        <input type="hidden" name="cat_id" value="${cat.cat_id}">
        <div class="layui-form-item">
            <label class="layui-form-label" for="name">分类名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" class="layui-input" id="name" value="${cat.name}" lay-verify="required" autocomplete="off" maxlength="15">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">分类图片</label>
            <div class="layui-input-block">
                <input type="file" id="file" name="file" autocomplete="off" class="_upfile">
                <input type="hidden" value="${cat.image!''}" name="image">
                <#if imgPath??>
                    <img alt="" src="${imgPath!''}" style="width: 50px; height: 50px;">
                </#if>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label" >是否为顶级分类</label>
            <div class="layui-input-block">
                <#assign x = cat.parent_id />
                <input type="radio" name="cattype" value="1" <#if (x == 0) >checked</#if> title="是">
                <input type="radio" name="cattype" value="0" <#if (x != 0) >checked</#if> title="否">
            </div>
        </div>

        <div class="layui-form-item discode" <#if (pathList?size!=4) >style="display: none"</#if> >
            <label style="width: 25%"  class="layui-form-label ">是否显示在首页</label>
            <div class="layui-input-block">
                <#assign y = cat.index_show!0 />
                <input type="radio" name="index_show" value="1" <#if (y==1) >checked</#if> title="是">
                <input type="radio" name="index_show" value="0" <#if (y!=1) >checked</#if> title="否">
            </div>
        </div>

        <div class="layui-form-item" <#if (x == 0) >style="display: none;"</#if> >
            <label class="layui-form-label">上级分类</label>
            <div class="layui-input-block">
                <input type="text" name="parent_id" id="cat_parent" autocomplete="off" placeholder="选择上级分类" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">商品类型</label>
            <div class="layui-input-block">
                <input type="text" name="type_id" id="goods_type" value="${cat.type_id!''}" placeholder="选择商品类型" autocomplete="off"  class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
                <input type="text" id="sort" name="cat_order" autocomplete="off" value="${cat.cat_order}" class="layui-input" value="0" maxlength="5">
            </div>
        </div>

        <div class="layui-form-item">
            <input type="hidden" name="list_show" value="1" checked="checked"/>
            <label class="layui-form-label">列表中显示</label>
            <div class="layui-input-block">
                <#assign y = cat.reveal />
                <input type="radio" name="whether" lay-filter="whether" value="1" <#if (y==1) >checked</#if> title="是">
                <input type="radio" name="whether" lay-filter="whether" value="0" <#if (y!=1) >checked</#if> title="否">
                <input type="hidden" name="reveal" id="reveal" value=${cat.reveal}>
            </div>
        </div>

    </form>
    <script>
        layui.use('form', function(){
            var form = layui.form();

            form.on('radio(whether)', function(data){
                if(data.value==1){
                    $("#reveal").val(data.value);
                }else{
                    $("#reveal").val(data.value);
                }
            });
        });
    </script>
</div>